package com.adcc.loadsheet.monitor.vo;

import com.adcc.loadsheet.monitor.entity.DatabaseMonitor;
import com.adcc.loadsheet.monitor.entity.MonitorStatus;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.common.base.Strings;

public class DatabaseMonitorVO extends BaseVO<DatabaseMonitor> {

    // 主IP
    private String masterIp;

    // 主进程比
    private double masterProcessUsage;

    // 主活跃进程数
    private int masterActiveProcess;

    // 主最大进程数
    private int masterMaxProcess;

    // 主磁盘使用率
    private double masterDiskUsage;

    // 主表空间使用率
    private double masterTablespaceUsage;

    // 主连接状态
    private MonitorStatus masterStatus;

    // 从IP
    private String slaveIp;

    // 从进程比
    private double slaveProcessUsage;

    // 从活跃进程数
    private int slaveActiveProcess;

    // 从最大进程数
    private int slaveMaxProcess;

    // 从磁盘使用率
    private double slaveDiskUsage;

    // 从表空间使用率
    private double slaveTablespaceUsage;

    // 从连接状态
    private MonitorStatus slaveStatus;

    // 数据库总状态
    private MonitorStatus status;

    public DatabaseMonitorVO() {

    }

    public DatabaseMonitorVO(DatabaseMonitor databaseMonitor) {
        masterIp = Strings.nullToEmpty(databaseMonitor.getMasterIp());
        masterProcessUsage = databaseMonitor.getMasterProcessUsage();
        masterActiveProcess = databaseMonitor.getMasterActiveProcess();
        masterMaxProcess = databaseMonitor.getMasterMaxProcess();
        masterDiskUsage = databaseMonitor.getMasterDiskUsage();
        masterTablespaceUsage = databaseMonitor.getMasterTablespaceUsage();
        masterStatus = databaseMonitor.getMasterStatus();
        slaveIp = Strings.nullToEmpty(databaseMonitor.getSlaveIp());
        slaveProcessUsage = databaseMonitor.getSlaveProcessUsage();
        slaveActiveProcess = databaseMonitor.getSlaveActiveProcess();
        slaveMaxProcess = databaseMonitor.getSlaveMaxProcess();
        slaveDiskUsage = databaseMonitor.getSlaveDiskUsage();
        slaveTablespaceUsage = databaseMonitor.getSlaveTablespaceUsage();
        slaveStatus = databaseMonitor.getSlaveStatus();
        status = databaseMonitor.getStatus();
    }

    public String getMasterIp() {
        return masterIp;
    }

    public void setMasterIp(String masterIp) {
        this.masterIp = masterIp;
    }

    public double getMasterProcessUsage() {
        return masterProcessUsage;
    }

    public void setMasterProcessUsage(double masterProcessUsage) {
        this.masterProcessUsage = masterProcessUsage;
    }

    public int getMasterActiveProcess() {
        return masterActiveProcess;
    }

    public void setMasterActiveProcess(int masterActiveProcess) {
        this.masterActiveProcess = masterActiveProcess;
    }

    public int getMasterMaxProcess() {
        return masterMaxProcess;
    }

    public void setMasterMaxProcess(int masterMaxProcess) {
        this.masterMaxProcess = masterMaxProcess;
    }

    public double getMasterDiskUsage() {
        return masterDiskUsage;
    }

    public void setMasterDiskUsage(double masterDiskUsage) {
        this.masterDiskUsage = masterDiskUsage;
    }

    public double getMasterTablespaceUsage() {
        return masterTablespaceUsage;
    }

    public void setMasterTablespaceUsage(double masterTablespaceUsage) {
        this.masterTablespaceUsage = masterTablespaceUsage;
    }

    public MonitorStatus getMasterStatus() {
        return masterStatus;
    }

    public void setMasterStatus(MonitorStatus masterStatus) {
        this.masterStatus = masterStatus;
    }

    public String getSlaveIp() {
        return slaveIp;
    }

    public void setSlaveIp(String slaveIp) {
        this.slaveIp = slaveIp;
    }

    public double getSlaveProcessUsage() {
        return slaveProcessUsage;
    }

    public void setSlaveProcessUsage(double slaveProcessUsage) {
        this.slaveProcessUsage = slaveProcessUsage;
    }

    public int getSlaveActiveProcess() {
        return slaveActiveProcess;
    }

    public void setSlaveActiveProcess(int slaveActiveProcess) {
        this.slaveActiveProcess = slaveActiveProcess;
    }

    public int getSlaveMaxProcess() {
        return slaveMaxProcess;
    }

    public void setSlaveMaxProcess(int slaveMaxProcess) {
        this.slaveMaxProcess = slaveMaxProcess;
    }

    public double getSlaveDiskUsage() {
        return slaveDiskUsage;
    }

    public void setSlaveDiskUsage(double slaveDiskUsage) {
        this.slaveDiskUsage = slaveDiskUsage;
    }

    public double getSlaveTablespaceUsage() {
        return slaveTablespaceUsage;
    }

    public void setSlaveTablespaceUsage(double slaveTablespaceUsage) {
        this.slaveTablespaceUsage = slaveTablespaceUsage;
    }

    public MonitorStatus getSlaveStatus() {
        return slaveStatus;
    }

    public void setSlaveStatus(MonitorStatus slaveStatus) {
        this.slaveStatus = slaveStatus;
    }

    public MonitorStatus getStatus() {
        return status;
    }

    public void setStatus(MonitorStatus status) {
        this.status = status;
    }

    @Override
    public DatabaseMonitor toEntity() {
        return null;
    }

    @Override
    public String toJSON() throws JsonProcessingException {
        return null;
    }
}
